﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using GestionBudget.Objects;

namespace GestionBudget.Controls
{
    public partial class ucConnexion : ControlObject
    {
        public ucConnexion()
        {
            InitializeComponent();
        }

        private void cmdConnexion_Click(object sender, EventArgs e)
        {
            if (cmbUsername.SelectedValue != null)
            {
                Securite.ProfilCourant = (Profil)cmbUsername.SelectedItem;

                this.Parent.Hide();
                FormPrincipal frmPrincipal = new FormPrincipal();
                frmPrincipal.Show();
                frmPrincipal.FrmConnexion = (FormConnexion)this.Parent;
            }
        }

        private void lbllkNouvelUtilisateur_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
        {
            (this.Parent as FormConnexion).ChangeInterfaceConnexion(true);
        }

        private void ucConnexion_VisibleChanged(object sender, EventArgs e)
        {
            if (this.Visible)
            {
                cmbUsername.DataSource = DictionnaireDonnees.ListeProfils.ToList();
            }
        }
    }
}
